/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       toggle_button.h

	$Header: /game/toggle_button.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef TOGGLE_BUTTON_H_INCLUDED
#define TOGGLE_BUTTON_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "button.h"
#include "toggle_button_ptr.h"

// ----------------------------------------------------------------------------
// button which switches between pressed / released states.  If "sticky", button
// cannot leave the "pressed" state unless the program sets that state.
// -----------------------------------------------------------------------------
class t_toggle_button : public t_button
{
public:
	// constructors
	// construct with a standard set of bitmaps, from a bitmap_group
    t_toggle_button( t_cached_ptr<t_button_bitmaps>& bitmaps, t_screen_point point,
		             t_window* parent, bool sticky = false, std::string const& text = "" );
    // start with no images.  Must set images manually.
	t_toggle_button( t_screen_point point, t_window* parent, bool sticky = false );

    virtual void left_button_down( t_mouse_event const& event ); 
    virtual void left_button_up( t_mouse_event const& event );
    virtual void mouse_leaving( t_window* old_window, t_window* new_window,
		                        t_mouse_event const& event );

	void set_pressed( bool arg = true );
	void set_sticky( bool arg );
protected:
	bool m_sticky;
};

inline void t_toggle_button::set_sticky( bool arg )
{
	m_sticky = arg;
}

#endif // TOGGLE_BUTTON_H_INCLUDED
